package com.zznj.xzjc.activity.person;

import android.view.View;
import android.widget.ImageView;

import com.zznj.xzjc.R;
import com.zznj.xzjc.base.BaseActivity;
import com.zznj.xzjc.net.SharedHelper;

import butterknife.BindView;
import butterknife.OnClick;


/**
 * Created by JY on 2017/11/15.
 */

public class PersonTuiSongSetActivity extends BaseActivity {

    @BindView(R.id.zdxsglImg)
    ImageView zdxsglImg;
    @BindView(R.id.zcfbImg)
    ImageView zcfbImg;
    @BindView(R.id.dxalImg)
    ImageView dxalImg;
    @BindView(R.id.tzggImg)
    ImageView tzggImg;

    private int xsglType = 0; // 0--否；1是
    private int zcfbType = 0; // 0--否；1是
    private int dxalType = 0; // 0--否；1是
    private int tzggType = 0; // 0--否；1是

    @Override
    protected int getLayoutId() {
        return R.layout.gyss_activity_tuisongset_layout;
    }

    @Override
    public void initView() {
        setTitle("推送设置");
        xsglType = SharedHelper.readValueByKeyForInt(mContext,"xsglType");
        zcfbType = SharedHelper.readValueByKeyForInt(mContext,"zcfbType");
        dxalType = SharedHelper.readValueByKeyForInt(mContext,"dxalType");
        tzggType = SharedHelper.readValueByKeyForInt(mContext,"tzggType");
        zdxsglImg.setImageResource(xsglType==1?R.mipmap.gyss_tuisongset_select:R.mipmap.gyss_tuisongset_normal);
        zcfbImg.setImageResource(zcfbType==1?R.mipmap.gyss_tuisongset_select:R.mipmap.gyss_tuisongset_normal);
        dxalImg.setImageResource(dxalType==1?R.mipmap.gyss_tuisongset_select:R.mipmap.gyss_tuisongset_normal);
        tzggImg.setImageResource(tzggType==1?R.mipmap.gyss_tuisongset_select:R.mipmap.gyss_tuisongset_normal);
    }

    @Override
    public void initData() {

    }

    @OnClick({R.id.zdxsglImg,R.id.zcfbImg,R.id.dxalImg,R.id.tzggImg})
    public void onViewClicked(View view) {
        if(view.getId() == R.id.zdxsglImg){
            if(xsglType == 0){
                xsglType = 1;
                zdxsglImg.setImageResource(R.mipmap.gyss_tuisongset_select);
            }else{
                xsglType = 0;
                zdxsglImg.setImageResource(R.mipmap.gyss_tuisongset_normal);
            }
            SharedHelper.saveKeyValueForInt(mContext,"xsglType",xsglType);
        }else if(view.getId() == R.id.zcfbImg){
            if(zcfbType == 0){
                zcfbType = 1;
                zcfbImg.setImageResource(R.mipmap.gyss_tuisongset_select);
            }else{
                zcfbType = 0;
                zcfbImg.setImageResource(R.mipmap.gyss_tuisongset_normal);
            }
            SharedHelper.saveKeyValueForInt(mContext,"zcfbType",zcfbType);
        }else if(view.getId() == R.id.dxalImg){
            if(dxalType == 0){
                dxalType = 1;
                dxalImg.setImageResource(R.mipmap.gyss_tuisongset_select);
            }else{
                dxalType = 0;
                dxalImg.setImageResource(R.mipmap.gyss_tuisongset_normal);
            }
            SharedHelper.saveKeyValueForInt(mContext,"dxalType",dxalType);
        }else{
            if(tzggType == 0){
                tzggType = 1;
                tzggImg.setImageResource(R.mipmap.gyss_tuisongset_select);
            }else{
                tzggType = 0;
                tzggImg.setImageResource(R.mipmap.gyss_tuisongset_normal);
            }
            SharedHelper.saveKeyValueForInt(mContext,"tzggType",tzggType);
        }
    }
}
